<template>
	<view>
		<view class="container p30">
			<view class="recommend-list">
				<view class="item flex-box" @click="navication(item.id,item.type)" open-type="redirect" v-for="(item,index) in courseLists" :key="item.id">
					<view class="pr mr30">
						<image class="img-post br10" :src="item.thumb_image" mode="aspectFill"></image>
						<!-- <view class="time">00:08:00</view> -->
					</view>
					<view class="flex-1">
						<view class="fs26 col-black mb70">{{item.name}}</view>
						<view class="flex-box">
							<image class="icon-media mr10" v-if="item.type==2" src="/static/icon/icon_book.png" mode="aspectFit"></image>
							<image class="icon-media mr10" v-else src="/static/icon/icon_tv.png" mode="aspectFit"></image>
							
							<view class="fs20 col-6">{{item.total_num}}人学习过</view>
						</view>
					</view>
				</view>
				
				<view class="g-btn3-wrap">
					<view class="g-btn3"  :class="{nomore: courseListsMore.nomore == true}" @click="fetch">{{courseListsMore.text}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const util = require('@/xiluedu/util.js');
	export default {
		data() {
			return {
				courseLists:[],
				courseListsMore:{page:1,text:'正在加载...'}
			}
		},
		onLoad(options){
			this.course_id = options.course_id;
			this.fetch();
		},
		methods: {
			fetch(){
				util.fetch(this, 'xiluedu.course/guess_like', {course_id:this.course_id,pagesize:10}, 'courseListsMore', 'courseLists', 'data', data=>{
				
				})
			},
			//推荐课程跳转
			navication(id, type) {
				if (type == 3) {
					// 文章
					uni.navigateTo({
						url: '../article_detail/article_detail?course_id=' + id
					});
				} else {
					uni.redirectTo({
						url: '../course_video_detail/course_video_detail?course_id=' + id
					});
				}
			},
			
		}
	}
</script>

<style scoped>

.recommend-list .item + .item {
	margin-top: 25rpx;
}
.recommend-list .img-post {
	display: block;
	width: 280rpx;
	height: 160rpx;
}
.recommend-list .time {
	position: absolute;
	left: 15rpx;
	bottom: 12rpx;
	padding: 6rpx 8rpx;
	background: rgba(0, 0, 0, 0.6);
	border-radius: 2rpx;
	font-size: 14rpx;
	color: #ffffff;
	line-height: 18rpx;
}
.recommend-list .icon-media {
	display: block;
	width: 30rpx;
	height: 30rpx;
}
</style>
